package com.Poly02;

public class Test {
    public static void main(String[] args) {
        worker worker = new worker("jack",5000);
        manager manager = new manager("tom",10000,5000);
        Test test = new Test();
        test.showEmpAnnual(worker);
        test.showEmpAnnual(manager);
        test.testwork(worker);
        test.testwork(manager);


    }
        public void showEmpAnnual(Employee e) {
            System.out.println(e.getAnnualSalary());

    }
    public void testwork(Employee e) {
        if(e instanceof worker){
            worker w = (worker) e;
            w.work();
            //进行向下转型操作
        } else if (e instanceof manager) {
            manager m = (manager) e;
            m.manage();
        }else{
            System.out.println("不做任何处理");
        }
    }
}

